package cn.itcast.mr.order;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 * Author itcast
 * Date 2021/10/17 16:28
 * Desc TODO
 */
public class OrderGrouping extends WritableComparator {
    public OrderGrouping(){
        super(OrderBean.class,true);
    }
    /**
     *
     * @param a 序列化和排序用到接口，自定义 OrderBean 实现这个接口
     * @param b
     * @return
     */
    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        OrderBean first = (OrderBean) a;
        OrderBean second = (OrderBean) b;
        int i = first.getOid().compareTo(second.getOid());
        return i;
    }
}
